<template>
	<view class="skeleton-list">
		<view v-for="i in count" :key="i" class="skeleton-item">
			<view class="skeleton-image"></view>
			<view class="skeleton-content">
				<view class="skeleton-title"></view>
				<view class="skeleton-row"></view>
				<view class="skeleton-row short"></view>
				<view class="skeleton-row"></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			count: {
				type: Number,
				default: 5
			}
		}
	}
</script>

<style lang="scss">
	.skeleton-list {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 8rpx;
	}

	.skeleton-item {
		width: 702rpx;
		height: 208rpx;
		background: #ffffff;
		border-radius: 16rpx;
		padding: 20rpx;
		display: flex;
		flex-direction: row;
		margin-top: 16rpx;
		overflow: hidden;
	}

	.skeleton-image {
		width: 168rpx;
		height: 168rpx;
		background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
		background-size: 200% 100%;
		border-radius: 16rpx;
		animation: loading 1.5s infinite;
	}

	.skeleton-content {
		margin-left: 20rpx;
		display: flex;
		flex-direction: column;
		width: 474rpx;
	}

	.skeleton-title {
		width: 60%;
		height: 32rpx;
		background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
		background-size: 200% 100%;
		border-radius: 8rpx;
		animation: loading 1.5s infinite;
		margin-bottom: 16rpx;
	}

	.skeleton-row {
		width: 100%;
		height: 24rpx;
		background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
		background-size: 200% 100%;
		border-radius: 8rpx;
		animation: loading 1.5s infinite;
		margin-bottom: 12rpx;
		
		&.short {
			width: 40%;
		}
	}

	@keyframes loading {
		0% {
			background-position: 200% 0;
		}
		100% {
			background-position: -200% 0;
		}
	}
</style>